' nhiệm vụ của class.
'
' - thực hiện quản lý nhóm người sử dụng và các phân quyền gán/không gán
' - form DE style
' - hủy bỏ nhóm không thực hiện tại đây
' 
' tạo bởi: Csung

Option Strict On
Option Explicit On 

Imports IP.Core.IPUserService
Imports IP.Core.IPData
Imports IP.Core.IPException
Imports IP.Core.IPCommon
Imports IP.Core.IPDataControl

Imports System.Windows.forms


Class f110_nhom_nguoi_su_dung_DE
    Inherits System.Windows.Forms.Form
    Implements I_InplaceEditGridContainer

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        format_controls()
    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents imageList As System.Windows.Forms.ImageList
    Friend WithEvents Panel3 As System.Windows.Forms.Panel
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents m_fg_phan_quyen_he_thong As C1.Win.C1FlexGrid.C1FlexGrid
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents m_stb_fms_style As System.Windows.Forms.StatusBar
    Friend WithEvents m_stMess As System.Windows.Forms.StatusBarPanel
    Friend WithEvents m_panel As System.Windows.Forms.Panel
    Friend WithEvents m_cmd_ok As SIS.Controls.Button.SiSButton
    Friend WithEvents m_cmd_cancel As SIS.Controls.Button.SiSButton
    Friend WithEvents m_lbl_viet_tat As System.Windows.Forms.Label
    Friend WithEvents m_lbl_ghi_chu As System.Windows.Forms.Label
    Friend WithEvents m_txt_ma_nhom As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents m_txt_ghi_chu As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(f110_nhom_nguoi_su_dung_DE))
        Me.imageList = New System.Windows.Forms.ImageList(Me.components)
        Me.Panel3 = New System.Windows.Forms.Panel
        Me.m_lbl_ghi_chu = New System.Windows.Forms.Label
        Me.m_lbl_viet_tat = New System.Windows.Forms.Label
        Me.m_txt_ghi_chu = New System.Windows.Forms.TextBox
        Me.m_txt_ma_nhom = New System.Windows.Forms.TextBox
        Me.Panel1 = New System.Windows.Forms.Panel
        Me.m_fg_phan_quyen_he_thong = New C1.Win.C1FlexGrid.C1FlexGrid
        Me.Label2 = New System.Windows.Forms.Label
        Me.m_stb_fms_style = New System.Windows.Forms.StatusBar
        Me.m_stMess = New System.Windows.Forms.StatusBarPanel
        Me.m_panel = New System.Windows.Forms.Panel
        Me.m_cmd_ok = New SIS.Controls.Button.SiSButton
        Me.m_cmd_cancel = New SIS.Controls.Button.SiSButton
        Me.Label1 = New System.Windows.Forms.Label
        Me.Panel3.SuspendLayout()
        Me.Panel1.SuspendLayout()
        CType(Me.m_fg_phan_quyen_he_thong, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.m_stMess, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.m_panel.SuspendLayout()
        Me.SuspendLayout()
        '
        'imageList
        '
        Me.imageList.ImageStream = CType(resources.GetObject("imageList.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.imageList.TransparentColor = System.Drawing.Color.Transparent
        Me.imageList.Images.SetKeyName(0, "")
        Me.imageList.Images.SetKeyName(1, "")
        Me.imageList.Images.SetKeyName(2, "")
        Me.imageList.Images.SetKeyName(3, "")
        Me.imageList.Images.SetKeyName(4, "")
        Me.imageList.Images.SetKeyName(5, "")
        Me.imageList.Images.SetKeyName(6, "")
        Me.imageList.Images.SetKeyName(7, "")
        Me.imageList.Images.SetKeyName(8, "")
        Me.imageList.Images.SetKeyName(9, "")
        '
        'Panel3
        '
        Me.Panel3.Controls.Add(Me.m_lbl_ghi_chu)
        Me.Panel3.Controls.Add(Me.m_lbl_viet_tat)
        Me.Panel3.Controls.Add(Me.m_txt_ghi_chu)
        Me.Panel3.Controls.Add(Me.m_txt_ma_nhom)
        Me.Panel3.Dock = System.Windows.Forms.DockStyle.Top
        Me.Panel3.Location = New System.Drawing.Point(0, 0)
        Me.Panel3.Name = "Panel3"
        Me.Panel3.Size = New System.Drawing.Size(818, 66)
        Me.Panel3.TabIndex = 25
        '
        'm_lbl_ghi_chu
        '
        Me.m_lbl_ghi_chu.Location = New System.Drawing.Point(12, 38)
        Me.m_lbl_ghi_chu.Name = "m_lbl_ghi_chu"
        Me.m_lbl_ghi_chu.Size = New System.Drawing.Size(62, 20)
        Me.m_lbl_ghi_chu.TabIndex = 3
        Me.m_lbl_ghi_chu.Text = "Ghi chú"
        Me.m_lbl_ghi_chu.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'm_lbl_viet_tat
        '
        Me.m_lbl_viet_tat.Location = New System.Drawing.Point(12, 16)
        Me.m_lbl_viet_tat.Name = "m_lbl_viet_tat"
        Me.m_lbl_viet_tat.Size = New System.Drawing.Size(62, 20)
        Me.m_lbl_viet_tat.TabIndex = 2
        Me.m_lbl_viet_tat.Text = "Viết tắt"
        Me.m_lbl_viet_tat.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'm_txt_ghi_chu
        '
        Me.m_txt_ghi_chu.Location = New System.Drawing.Point(78, 38)
        Me.m_txt_ghi_chu.Name = "m_txt_ghi_chu"
        Me.m_txt_ghi_chu.Size = New System.Drawing.Size(642, 20)
        Me.m_txt_ghi_chu.TabIndex = 1
        Me.m_txt_ghi_chu.Text = "m_txt_ghi_chu"
        '
        'm_txt_ma_nhom
        '
        Me.m_txt_ma_nhom.Location = New System.Drawing.Point(78, 16)
        Me.m_txt_ma_nhom.Name = "m_txt_ma_nhom"
        Me.m_txt_ma_nhom.Size = New System.Drawing.Size(204, 20)
        Me.m_txt_ma_nhom.TabIndex = 0
        Me.m_txt_ma_nhom.Text = "m_txt_ma_nhom"
        '
        'Panel1
        '
        Me.Panel1.Controls.Add(Me.Label1)
        Me.Panel1.Controls.Add(Me.m_fg_phan_quyen_he_thong)
        Me.Panel1.Controls.Add(Me.Label2)
        Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.Panel1.Location = New System.Drawing.Point(0, 66)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Padding = New System.Windows.Forms.Padding(4)
        Me.Panel1.Size = New System.Drawing.Size(818, 502)
        Me.Panel1.TabIndex = 26
        '
        'm_fg_phan_quyen_he_thong
        '
        Me.m_fg_phan_quyen_he_thong.AllowAddNew = True
        Me.m_fg_phan_quyen_he_thong.ColumnInfo = resources.GetString("m_fg_phan_quyen_he_thong.ColumnInfo")
        Me.m_fg_phan_quyen_he_thong.Dock = System.Windows.Forms.DockStyle.Fill
        Me.m_fg_phan_quyen_he_thong.KeyActionEnter = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross
        Me.m_fg_phan_quyen_he_thong.Location = New System.Drawing.Point(4, 46)
        Me.m_fg_phan_quyen_he_thong.Name = "m_fg_phan_quyen_he_thong"
        Me.m_fg_phan_quyen_he_thong.Rows.Count = 43
        Me.m_fg_phan_quyen_he_thong.Size = New System.Drawing.Size(810, 452)
        Me.m_fg_phan_quyen_he_thong.Styles = CType(New C1.Win.C1FlexGrid.CellStyleCollection(""), C1.Win.C1FlexGrid.CellStyleCollection)
        Me.m_fg_phan_quyen_he_thong.TabIndex = 25
        '
        'Label2
        '
        Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Label2.Dock = System.Windows.Forms.DockStyle.Top
        Me.Label2.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Image = CType(resources.GetObject("Label2.Image"), System.Drawing.Image)
        Me.Label2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Label2.Location = New System.Drawing.Point(4, 4)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(810, 42)
        Me.Label2.TabIndex = 23
        Me.Label2.Text = "Phân quyền Hệ thống cho nhóm"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'm_stb_fms_style
        '
        Me.m_stb_fms_style.ImeMode = System.Windows.Forms.ImeMode.NoControl
        Me.m_stb_fms_style.Location = New System.Drawing.Point(0, 602)
        Me.m_stb_fms_style.Name = "m_stb_fms_style"
        Me.m_stb_fms_style.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.m_stMess})
        Me.m_stb_fms_style.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.m_stb_fms_style.ShowPanels = True
        Me.m_stb_fms_style.Size = New System.Drawing.Size(818, 22)
        Me.m_stb_fms_style.TabIndex = 27
        Me.m_stb_fms_style.Text = "statusBar"
        '
        'm_stMess
        '
        Me.m_stMess.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring
        Me.m_stMess.Icon = CType(resources.GetObject("m_stMess.Icon"), System.Drawing.Icon)
        Me.m_stMess.Name = "m_stMess"
        Me.m_stMess.Width = 801
        '
        'm_panel
        '
        Me.m_panel.Controls.Add(Me.m_cmd_ok)
        Me.m_panel.Controls.Add(Me.m_cmd_cancel)
        Me.m_panel.Dock = System.Windows.Forms.DockStyle.Bottom
        Me.m_panel.Location = New System.Drawing.Point(0, 568)
        Me.m_panel.Name = "m_panel"
        Me.m_panel.Padding = New System.Windows.Forms.Padding(4)
        Me.m_panel.Size = New System.Drawing.Size(818, 34)
        Me.m_panel.TabIndex = 28
        '
        'm_cmd_ok
        '
        Me.m_cmd_ok.AdjustImageLocation = New System.Drawing.Point(0, 0)
        Me.m_cmd_ok.BtnShape = SIS.Controls.Button.emunType.BtnShape.Rectangle
        Me.m_cmd_ok.BtnStyle = SIS.Controls.Button.emunType.XPStyle.[Default]
        Me.m_cmd_ok.Dock = System.Windows.Forms.DockStyle.Right
        Me.m_cmd_ok.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.m_cmd_ok.ImageIndex = 9
        Me.m_cmd_ok.ImageList = Me.imageList
        Me.m_cmd_ok.Location = New System.Drawing.Point(654, 4)
        Me.m_cmd_ok.Name = "m_cmd_ok"
        Me.m_cmd_ok.Size = New System.Drawing.Size(80, 26)
        Me.m_cmd_ok.TabIndex = 17
        Me.m_cmd_ok.Text = "&Lưu"
        '
        'm_cmd_cancel
        '
        Me.m_cmd_cancel.AdjustImageLocation = New System.Drawing.Point(0, 0)
        Me.m_cmd_cancel.BtnShape = SIS.Controls.Button.emunType.BtnShape.Rectangle
        Me.m_cmd_cancel.BtnStyle = SIS.Controls.Button.emunType.XPStyle.[Default]
        Me.m_cmd_cancel.Dock = System.Windows.Forms.DockStyle.Right
        Me.m_cmd_cancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.m_cmd_cancel.ImageIndex = 4
        Me.m_cmd_cancel.ImageList = Me.imageList
        Me.m_cmd_cancel.Location = New System.Drawing.Point(734, 4)
        Me.m_cmd_cancel.Name = "m_cmd_cancel"
        Me.m_cmd_cancel.Size = New System.Drawing.Size(80, 26)
        Me.m_cmd_cancel.TabIndex = 16
        Me.m_cmd_cancel.Text = "&Hủy bỏ"
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(7, 1)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(39, 13)
        Me.Label1.TabIndex = 26
        Me.Label1.Text = "Label1"
        '
        'f110_nhom_nguoi_su_dung_DE
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(818, 624)
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.m_panel)
        Me.Controls.Add(Me.m_stb_fms_style)
        Me.Controls.Add(Me.Panel3)
        Me.Name = "f110_nhom_nguoi_su_dung_DE"
        Me.Text = "M110 - Quan ly nhom nguoi su dung"
        Me.Panel3.ResumeLayout(False)
        Me.Panel3.PerformLayout()
        Me.Panel1.ResumeLayout(False)
        Me.Panel1.PerformLayout()
        CType(Me.m_fg_phan_quyen_he_thong, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.m_stMess, System.ComponentModel.ISupportInitialize).EndInit()
        Me.m_panel.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

#Region "public interface"

    Public Sub insert_usergroup(ByVal i_us_usergroup As US_HT_NHOM_NGUOI_SU_DUNG, _
                                ByRef o_dialog_result As DialogResult)
        m_form_mode = DataEntryFormMode.InsertDataState
        m_us_usergroup = i_us_usergroup
        Me.ShowDialog()
        o_dialog_result = m_dialog_result
    End Sub

    Public Sub update_usergroup(ByVal i_us_usergroup As US_HT_NHOM_NGUOI_SU_DUNG, _
                                ByVal i_ds_right As DS_HT_PHAN_QUYEN_HE_THONG, _
                                ByRef o_dialog_result As DialogResult)
        m_form_mode = DataEntryFormMode.UpdateDataState
        m_us_usergroup = i_us_usergroup
        Me.ShowDialog()
        o_dialog_result = m_dialog_result
    End Sub
#End Region

#Region "Data structures"

    Private Enum ColNumberRight
        Thuoc_loai = 1
        Ma_phan_quyen = 2
        Ghi_chu = 3
        Duoc_gan = 4
        ID = 5
    End Enum


#End Region

#Region "Members"
    Dim m_form_mode As DataEntryFormMode = DataEntryFormMode.InsertDataState
    Dim m_dialog_result As DialogResult = DialogResult.Cancel
    Dim m_us_usergroup As US_HT_NHOM_NGUOI_SU_DUNG
    Dim m_obj_right_row_trans As ITransferDataRow
    Dim m_ds_v_phan_quyen_gan_cho_nhom As New IP.Core.IPData.DS_V_PHAN_QUYEN_GAN_CHO_NHOM
    Dim m_ied_right As C1InPlaceEditControl
    Dim m_info_message_handler As IPStatusBarMessages
#End Region

#Region "Private rountines"
    Private Function validate_data() As Boolean
        If Not CValidateTextBox.isValidStatusBarMsg(m_txt_ma_nhom, DataType.StringType, allowNull.NO, m_info_message_handler, True) Then Return False
        If Not CValidateTextBox.isValidStatusBarMsg(m_txt_ghi_chu, DataType.StringType, allowNull.NO, m_info_message_handler, True) Then Return False
        Return True
    End Function

    Private Sub insert_data()
        Try
            Me.m_us_usergroup.Insert()

            Dim v_updated_row_object As InplaceEditedRowObject
            For Each v_updated_row_object In m_ied_right.get_updated_row_objects()
                Dim v_us_v_phan_quyen_duoc_gan As US_V_PHAN_QUYEN_GAN_CHO_NHOM = CType(v_updated_row_object.edited_us_object, US_V_PHAN_QUYEN_GAN_CHO_NHOM)
                v_us_v_phan_quyen_duoc_gan.use_connection(m_us_usergroup.get_connection)
                v_us_v_phan_quyen_duoc_gan.dcNHOM_NGUOI_SU_DUNG_ID = m_us_usergroup.dcID
                v_us_v_phan_quyen_duoc_gan.Update()
            Next
        Catch v_ex As Exception
            Throw v_ex
        End Try
    End Sub

    Private Sub update_data()
        Try
            Me.m_us_usergroup.Update()
            Dim v_updated_row_object As InplaceEditedRowObject
            For Each v_updated_row_object In m_ied_right.get_updated_row_objects()
                v_updated_row_object.edited_us_object.use_connection(m_us_usergroup.get_connection)
                v_updated_row_object.edited_us_object.Update()
            Next
        Catch v_ex As Exception
            Throw v_ex
        End Try
    End Sub

    Private Sub submit_data()
        If Not validate_data() Then Exit Sub
        form_2_us_object()
        Dim c_str_save_point As String = "X"
        m_us_usergroup.setSavePoint(c_str_save_point)
        Try
            Select Case m_form_mode
                Case DataEntryFormMode.InsertDataState
                    insert_data()
                Case DataEntryFormMode.UpdateDataState
                    update_data()
            End Select
            m_dialog_result = DialogResult.OK
            Me.Close()
        Catch v_e As Exception
            m_us_usergroup.rollbackToSavePoint(c_str_save_point)
            Dim v_err_handler As New CDBExceptionHandler(v_e, New CDBClientDBExceptionInterpret)
            Select Case v_err_handler.getDBErrorIndex
                Case CDBExceptionHandler.DBErrorIndex.DuplicateIndex
                    IP.Core.IPCommon.BaseMessages.MsgBox_Error(601)
                Case Else
                    v_err_handler.showErrorMessage()
            End Select

        End Try
    End Sub

    Private Function get_trans_obj_right() As ITransferDataRow
        Dim v_hasttable As New Hashtable
        v_hasttable.Add(IPData.IPDBName.V_PHAN_QUYEN_GAN_CHO_NHOM.MA_PHAN_QUYEN, ColNumberRight.Ma_phan_quyen)
        v_hasttable.Add(IPData.IPDBName.V_PHAN_QUYEN_GAN_CHO_NHOM.LOAI_PHAN_QUYEN, ColNumberRight.Thuoc_loai)
        v_hasttable.Add(IPData.IPDBName.V_PHAN_QUYEN_GAN_CHO_NHOM.GHI_CHU, ColNumberRight.Ghi_chu)
        v_hasttable.Add(IPData.IPDBName.V_PHAN_QUYEN_GAN_CHO_NHOM.ID, ColNumberRight.ID)
        v_hasttable.Add(IPData.IPDBName.V_PHAN_QUYEN_GAN_CHO_NHOM.DUOC_GAN_YN, ColNumberRight.Duoc_gan)
        Dim v_dr_right As DataRow = (New DS_V_PHAN_QUYEN_GAN_CHO_NHOM).V_PHAN_QUYEN_GAN_CHO_NHOM.NewRow
        Dim v_obj_trans As New CC1TransferDataRow(m_fg_phan_quyen_he_thong, v_hasttable, v_dr_right)
        Return v_obj_trans
    End Function





    Private Sub format_controls()
        'CControlFormat.setFormStyle(Me, New CApplicationContext, IPFormStyle.DialogForm)
        CControlFormat.setFormStyle(Me, IPFormStyle.DialogForm)
        CControlFormat.setC1FlexFormat(m_fg_phan_quyen_he_thong, C1GridStyle.GridViewAndSearch)
        m_fg_phan_quyen_he_thong.AllowEditing = True
        CControlFormat.setLabelStyle(m_lbl_ghi_chu, LabelStyle.Prompt_Info)
        CControlFormat.setLabelStyle(m_lbl_viet_tat, LabelStyle.Prompt_Info)
    End Sub

    Private Sub load_data_to_phan_quyen_he_thong_grid(ByVal i_dc_usergroup_id As Decimal)
        Try
            Dim v_us_nhom As New US_HT_NHOM_NGUOI_SU_DUNG
            v_us_nhom.use_connection(m_us_usergroup.get_connection())
            v_us_nhom.fill_right_granted_2_usergroup(i_dc_usergroup_id, m_ds_v_phan_quyen_gan_cho_nhom)
            C1InPlaceEditControl.Dataset2C1Grid(m_ds_v_phan_quyen_gan_cho_nhom, m_fg_phan_quyen_he_thong, m_obj_right_row_trans)
        Catch ex As Exception
            CSystemLog_301.ExceptionHandle(ex)
        End Try

    End Sub

    Private Sub us_object_2_form()
        Select Case m_form_mode
            Case DataEntryFormMode.UpdateDataState
                m_txt_ghi_chu.Text = m_us_usergroup.strGHI_CHU
                m_txt_ma_nhom.Text = m_us_usergroup.strMA_NHOM
                load_data_to_phan_quyen_he_thong_grid(m_us_usergroup.dcID)
            Case DataEntryFormMode.InsertDataState
                m_txt_ghi_chu.Text = ""
                m_txt_ma_nhom.Text = ""
                load_data_to_phan_quyen_he_thong_grid(0)
        End Select

    End Sub

    Private Sub form_2_us_object()
        m_us_usergroup.strMA_NHOM = Me.m_txt_ma_nhom.Text
        m_us_usergroup.strGHI_CHU = Me.m_txt_ghi_chu.Text
        If Me.m_form_mode = DataEntryFormMode.InsertDataState Then
            m_us_usergroup.strINPUTED_BY = CApplicationContext.get_curent_user
            m_us_usergroup.datINPUTED_DATE = CApplicationContext.get_current_business_date
        End If
        m_us_usergroup.strLAST_UPDATED_BY = CApplicationContext.get_curent_user
        m_us_usergroup.datLAST_UPDATED = CApplicationContext.get_current_business_date
    End Sub
#End Region

#Region "Inplace editing interface"

    Function is_empty_row(ByVal i_grid_row_index As Integer) As Boolean Implements I_InplaceEditGridContainer.is_empty_row
        Debug.Assert(False, "Không có row empty ở đây")
        Return False
    End Function
    Public Function get_updated_row_Object(ByVal i_grid_row_index As Integer) As InplaceEditedRowObject Implements I_InplaceEditGridContainer.get_updated_row_object
        'GET US OBJECT AND DATAROW
        Dim v_us As New US_V_PHAN_QUYEN_GAN_CHO_NHOM
        Dim v_data_row As DataRow = CType(m_fg_phan_quyen_he_thong.Rows(i_grid_row_index).UserData, DataRow)
        v_us.DataRow2Me(v_data_row)
        'SET THE DATA HAVE BEEN EDITED IN THE ROW
        v_us.strDUOC_GAN_YN = CIPConvert.ToYNString(CType(m_fg_phan_quyen_he_thong(i_grid_row_index, ColNumberRight.Duoc_gan), Boolean))
        'MAKE OBJECT EDITED
        Return New InplaceEditedRowObject(v_us, v_data_row, InPlaceEditRowState.Updated)
    End Function

    Public Function get_deleted_row_object(ByVal i_grid_row_index As Integer) As InplaceEditedRowObject Implements I_InplaceEditGridContainer.get_deleted_row_object
        Debug.Assert(False, "Không xóa row  ở đây")
    End Function

    Public Function get_new_row_object(ByVal i_grid_row_index As Integer) As InplaceEditedRowObject Implements I_InplaceEditGridContainer.get_new_row_object
        Debug.Assert(False, "Không làm row mới ở đây")
        Return Nothing
    End Function
#End Region

    '
    ' EVENT HANDLERS
    '
    '

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        Try
            m_obj_right_row_trans = Me.get_trans_obj_right
            m_ied_right = New C1InPlaceEditControl(m_fg_phan_quyen_he_thong, Me)
            us_object_2_form()
            m_info_message_handler = New IPStatusBarMessages(m_stb_fms_style)
        Catch ex As Exception
            CSystemLog_301.ExceptionHandle(ex)
        End Try
    End Sub


    Private Sub m_cmd_cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m_cmd_cancel.Click
        Try
            Me.Close()
        Catch ex As Exception
            CSystemLog_301.ExceptionHandle(ex)
        End Try
    End Sub

    Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
        Try
            Select Case e.KeyCode
                Case Keys.Escape
                    Me.Close()
            End Select
        Catch ex As Exception
            CSystemLog_301.ExceptionHandle(ex)
        End Try
    End Sub

    Private Sub m_fg_phan_quyen_he_thong_StartEdit(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles m_fg_phan_quyen_he_thong.StartEdit
        Try
            Select Case e.Col
                Case ColNumberRight.Duoc_gan

                Case Else
                    e.Cancel = True
            End Select

        Catch ex As Exception
            CSystemLog_301.ExceptionHandle(ex)
        End Try
    End Sub

    Private Sub m_cmd_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m_cmd_ok.Click
        Try
            submit_data()
        Catch ex As Exception
            CSystemLog_301.ExceptionHandle(ex)
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim v As New f111_system_admin_main
        v.ShowDialog()
    End Sub
End Class
